/*
 * LeftUkazatelPanel.java
 *
 * Created on 18. �erven 2007, 11:36
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package cz.possoft.client.chess.gui.panel;

import info.clearthought.layout.TableLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;

import cz.possoft.generic.utils.GenericUtils;

/**
 *
 * @author mara
 */
public class SpodniUkazatelPanel extends JPanel {
    
    private double chessSize[][] =
        {
        {4,25,55,55,55,55,55,55,55,55,4},{15,10}};
    
    private static final String values[] = {"A", "B", "C", "D", "E", "F", "G", "H"};
    
    // pole s hodnotama spodu sachovnice - A , B , C ...
    private JLabel labels[] = {new JLabel("A"), new JLabel("B"), new JLabel("C"), new JLabel("D"), new JLabel("E"), new JLabel("F"), new JLabel("G"), new JLabel("H")};
    
    /** Creates a new instance of LeftUkazatelPanel */
    public SpodniUkazatelPanel() {
        initContents();
    }
    
    public void initContents() {
        setLayout(new TableLayout(chessSize));
        for (int i = 0; i < 8 ; i++) {
        	add(labels[i], String.valueOf(i + 2) + ",0");
        }                    
    }
    
    // nastavi labely na sachovnici podle barvy hrace (otoceni sachovnice)
    public void setLabelsForColor(int color) {
          if (color == GenericUtils.COLOR_WHITE) {
              for (int i = 0; i < 8 ; i++) {
              	labels[i].setText(values[i]);
              }              	  
          }
          else {
              for (int i = 0; i < 8 ; i++) {
                	labels[i].setText(values[7 - i]);
                }              	  
          }
    }    
    
}
